﻿<Application x:Class="Samples.GasyTek.Lakana.Navigation.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:lakana="http://schemas.gasytek.com/wpf/lakana" ShutdownMode="OnMainWindowClose"
             Startup="ApplicationStartup">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/ExpressionDark.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="TextBlock">
                <Setter Property="FontFamily"
                        Value="Segoe WP" />
            </Style>

            <Style TargetType="{x:Type ListBox}">
                <Setter Property="Background"
                        Value="{DynamicResource WindowBackgroundBrush}" />
                <Setter Property="Foreground" 
                        Value="White" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListBox}">
                            <Grid>
                                <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" Background="{TemplateBinding Background}" />
                                <ScrollViewer Margin="1" Style="{DynamicResource NuclearScrollViewer}" Focusable="false" Background="{x:Null}">
                                    <StackPanel Margin="1,1,1,1" IsItemsHost="true" />
                                </ScrollViewer>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Background" Value="Transparent" TargetName="Border" />
                                    <Setter Property="BorderBrush" Value="Transparent" TargetName="Border" />
                                </Trigger>
                                <Trigger Property="IsGrouping" Value="true">
                                    <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- Style for views that use MVVM -->
            <Style x:Key="ViewDefaultStyle"
                   TargetType="UserControl">
                <Setter Property="Background"
                        Value="{DynamicResource WindowBackgroundBrush}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="UserControl">
                            <DockPanel Background="{TemplateBinding Background}">
                                <TextBlock DockPanel.Dock="Top"
                                           Text="{Binding UIMetadata.Label}"
                                           Foreground="White"
                                           FontSize="40"
                                           Margin="20,10,10,10" />
                                <ContentPresenter ContentSource="Content"
                                                  Margin="0,10,0,0" />
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- Style for views that do not use MVVM -->
            <Style x:Key="ViewOnlyDefaultStyle"
                   TargetType="UserControl">
                <Setter Property="Background"
                        Value="{DynamicResource WindowBackgroundBrush}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="UserControl">
                            <DockPanel Background="{TemplateBinding Background}">
                                <TextBlock DockPanel.Dock="Top"
                                           Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=UIMetadata.Label}"
                                           Foreground="White"
                                           FontSize="40"
                                           Margin="20,10,10,10" />
                                <ContentPresenter ContentSource="Content"
                                                  Margin="0,10,0,0" />
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- Default style for MessageBox dialog -->

            <Style TargetType="{x:Type lakana:MessageBoxControl}">
                <Setter Property="Background"
                        Value="{DynamicResource WindowBackgroundBrush}" />
            </Style>

        </ResourceDictionary>
    </Application.Resources>
</Application>
